package com.chuxuan.Math.Sort;

public class BubbleSort extends Ordination{

    public	BubbleSort(Integer ar[]){
        System.out.println("-----------BubbleSort-----------");
        Sort(ar);
//	System.out.println(Arrays.toString( a));
    }
    public void Sort(Integer ar[]){
        Integer a[]=ar.clone();
        int temp=0;
        for(int i=0;i<a.length-1;i++){
            for(int j=0;j<a.length-1-i;j++){
                if(a[j]>a[j+1]) {
                    temp = a[j];
                    a[j] = a[j + 1];
                    a[j + 1] = temp;
                }
            }
        }

        this.ar=a;
    }
}
